<template>
  <div class="ele-body">
    <el-card shadow="never">
      <!-- 搜索表单 -->
      <el-form
        :model="where"
        label-width="83px"
        class="ele-form-search"
        @keyup.enter.native="reload"
        @submit.native.prevent
      >
        <el-row :gutter="15">
          <el-col :lg="12" :md="12">
            <el-form-item label="游戏包名称">
              <el-input
                :placeholder="'请输入游戏包名称'"
                v-model="where.package_name"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :lg="12" :md="12">
            <el-form-item label="关联游戏:">
              <PageSelect
                :placeholder="'请选择关联游戏'"
                v-model="where.game_id"
                :whereName="'game_name'"
                :url="'/game/index'"
                :optionLable="'game_name'"
                :optionvalue="'id'"
                :multiple="false"
              />
            </el-form-item>
          </el-col>
          <el-col :lg="12" :md="12">
            <el-form-item label="所属渠道:">
              <PageSelect
                :placeholder="'请选择所属渠道'"
                v-model="where.channel_id"
                :whereName="'name'"
                :url="'/channel/index'"
                :optionLable="'name'"
                :optionvalue="'id'"
                :multiple="false"
              />
            </el-form-item>
          </el-col>
          <el-col :lg="12" :md="12">
            <el-form-item label="版本:">
              <el-select
                clearable
                v-model="where.sdk_version"
                placeholder="请选择版本"
                class="ele-fluid"
              >
                <el-option
                  v-for="item in redios"
                  :key="item.id"
                  :value="item.id"
                  :label="item.name"
                >
                  {{ item.name }}
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :lg="12" :md="12">
            <el-form-item label="状态:">
              <el-select
                clearable
                v-model="where.status"
                placeholder="请选择状态"
                class="ele-fluid"
              >
                <el-option label="启用" value="1" />
                <el-option label="禁用" value="0" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :lg="12" :md="12">
            <el-form-item label="bundle_id:">
              <el-input
                :placeholder="'请输入bundle_id'"
                v-model="where.bundle_id"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :lg="12" :md="12">
            <div class="ele-form-actions">
              <el-button
                type="primary"
                icon="el-icon-search"
                class="ele-btn-icon"
                @click="reload"
                >查询
              </el-button>
              <el-button @click="reset">重置</el-button>
            </div>
          </el-col>
        </el-row>
      </el-form>
      <!-- 数据表格 -->
      <ele-pro-table
        ref="table"
        :where="where"
        :datasource="url"
        :columns="columns"
        :selection.sync="selection"
        height="calc(100vh - 315px)"
      >
        <!-- 表头工具栏 -->
        <template slot="toolbar">
          <el-button
            size="small"
            type="primary"
            icon="el-icon-plus"
            class="ele-btn-icon"
            @click="openEdit(null, null)"
            v-if="permission.includes('sys:package:add')"
            >添加
          </el-button>
          <!-- <el-button
            size="small"
            type="info"
            icon="el-icon-files"
            class="ele-btn-icon"
            @click="openPackageChannelApplyBatch()"
            
            >批量渠道打包
          </el-button> -->
          <el-dropdown>
            <el-button type="primary">
              批量操作<i class="el-icon-arrow-down el-icon--right"></i>
            </el-button>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item @click.native="openPackageChannelApplyBatch()" v-if="permission.includes('sys:package:PackageBatch')">
                <el-link type="primary" :underline="false">批量渠道打包 </el-link>
              </el-dropdown-item>
              <el-dropdown-item @click.native="openPayEdit(null, true)">
                <el-link
                  type="primary"
                  :underline="false"
                  v-if="permission.includes('sys:package:setPackagePayConfig')"
                  >支付配置
                </el-link>
              </el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
          <!-- <el-button
            size="small"
            type="danger"
            icon="el-icon-delete"
            class="ele-btn-icon"
            @click="removeBatch"
            v-if="permission.includes('sys:package:dall')"
            >删除
          </el-button> -->
        </template>
        <!-- 操作列 -->
        <template slot="action" slot-scope="{ row }">
          <el-dropdown>
            <el-button type="primary">
              操作列表<i class="el-icon-arrow-down el-icon--right"></i>
            </el-button>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item @click.native="openCopy(row)">
                <el-link type="primary" :underline="false">复制 </el-link>
              </el-dropdown-item>
              <el-dropdown-item @click.native="openEdit(row, false)">
                <el-link
                  type="primary"
                  :underline="false"
                  v-if="permission.includes('sys:package:edit')"
                  >修改
                </el-link></el-dropdown-item
              >

              <el-dropdown-item @click.native="openEdit(row, true)">
                <el-link
                  type="primary"
                  :underline="false"
                  v-if="
                    row.relation_package_id == row.id &&
                    row.all_sdk_version != '1,2,3,4'
                  "
                  >关联
                </el-link>
              </el-dropdown-item>
              <el-dropdown-item @click.native="openSdkEdit(row, true)">
                <el-link
                  type="primary"
                  :underline="false"
                  v-if="permission.includes('sys:package:setPackageSdkConfig')"
                  >sdk配置
                </el-link>
              </el-dropdown-item>
              <el-dropdown-item @click.native="openPayEdit(row, true)">
                <el-link
                  type="primary"
                  :underline="false"
                  v-if="permission.includes('sys:package:setPackagePayConfig')"
                  >支付配置
                </el-link>
              </el-dropdown-item>
              <el-dropdown-item @click.native="openAgeEdit(row, true)">
                <el-link
                  type="primary"
                  :underline="false"
                  v-if="permission.includes('sys:package:setPackageAgeConfig')"
                  >适龄配置
                </el-link>
              </el-dropdown-item>
              <el-dropdown-item @click.native="openChannelTemplate(row, true)">
                <el-link
                  type="primary"
                  :underline="false"
                  v-if="
                    permission.includes('sys:package:setPackageTemplateConfig')
                  "
                  >商务参数配置
                </el-link>
              </el-dropdown-item>
              <el-dropdown-item @click.native="openLandingPage(row, true)">
                <el-link
                  type="primary"
                  :underline="false"
                  v-if="
                    permission.includes(
                      'sys:package:setPackagelandingPagelandingPage'
                    )
                  "
                  >落地页模板配置
                </el-link>
              </el-dropdown-item>
              <el-dropdown-item>
                <!-- <el-link
                  type="primary"
                  :underline="false"
                  @click="openSign(row, true)"
                  v-if="
                    permission.includes(
                      'sys:package:setPackagelandingPagelandingPage'
                    )
                  "
                  >签名配置
                </el-link> -->
              </el-dropdown-item>
              <el-dropdown-item @click.native="openPackageConfig(row, true)">
                <el-link
                  type="primary"
                  :underline="false"
                  v-if="permission.includes('sys:package:setPackageConfig')"
                  >渠道打包配置
                </el-link>
              </el-dropdown-item>
              <el-dropdown-item @click.native="openPackagePCSDK(row)">
                <el-link
                  type="primary"
                  :underline="false"
                  v-if="row.sdk_version == 4"
                  >PC SDK热更新配置
                </el-link>
              </el-dropdown-item>
              <el-dropdown-item @click.native="openAdvertising(row)">
                <el-link type="primary" :underline="false"
                  >广告商务参数配置
                </el-link>
              </el-dropdown-item>
              <el-dropdown-item>
                <el-popconfirm
                  title="是否打包"
                  @confirm="openPackageChannelApply(row)"
                  confirmButtonText="确定"
                  cancelButtonText="取消"
                  v-if="permission.includes('sys:package:Package')"
                >
                  <el-link type="primary" slot="reference">渠道打包</el-link>
                </el-popconfirm>
              </el-dropdown-item>
              <el-dropdown-item @click.native="setApplyStatus(row)">
                <el-link type="primary" :underline="false"
                  >重新打包(推广分包)
                </el-link>
              </el-dropdown-item>
              <el-dropdown-item @click.native="setProduct(row)">
                <el-link type="primary" :underline="false">同步计费点 </el-link>
              </el-dropdown-item>
              <el-dropdown-item @click.native="openSDKMaintain(row)">
                <el-link
                  type="primary"
                  :underline="false"
                  v-if="permission.includes('sys:package:SDKMaintain')"
                  >SDK维护配置
                </el-link>
              </el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </template>
        <template slot="avatar" slot-scope="{ row }">
          <el-image
            style="width: 30px; height: 30px"
            :src="row.icon"
            fit="fit"
          ></el-image>
        </template>
      </ele-pro-table>
    </el-card>
    <!-- 编辑弹窗 -->
    <package-edit
      :data="current"
      :visible.sync="showEdit"
      :visibleRelevance.sync="showEditRelevance"
      @done="reload"
    />
    <package-sdkEdit
      :data="current"
      :visible.sync="showSdkEdit"
      @done="reload"
    />
    <package-payEdit
      v-if="showPayEdit"
      :data="current"
      :visible.sync="showPayEdit"
      :selectPackage="selectPackage"
      @done="reload"
    />
    <package-ageEdit
      :data="current"
      :visible.sync="showAgeEdit"
      @done="reload"
    />
    <channel-template
      :data="current"
      :visible.sync="showChannelTemplate"
      @done="reload"
    />
    <package-landingPage
      :data="current"
      :visible.sync="showlandingPage"
      @done="reload"
    />
    <package-sign :data="current" :visible.sync="showSign" @done="reload" />
    <package-packageConfig
      :data="current"
      :visible.sync="showPackageConfig"
      @done="reload"
    />
    <packagePcSDK :data="current" :visible.sync="showPCSDK" @done="reload" />
    <PackageAdvertising
      :data="current"
      :visible.sync="showAdvertising"
      @done="reload"
    />
    <PackageProduct
      :data="current"
      :visible.sync="showProduct"
      @done="reload"
    />
    <PackageSDKMaintain
      :data="current"
      :visible.sync="showSDKMaintain"
      @done="reload"
    />
  </div>
</template>
<script>
import { mapGetters } from 'vuex'
import PackageEdit from './package-edit'
import PackageSdkEdit from './package-sdkEdit'
import PackagePayEdit from './package-payEdit'
import PackageAgeEdit from './package-ageEdit'
import ChannelTemplate from './package-channelTemplate'
import PackageLandingPage from './package-landingPage'
import PackageSign from './package-sign'
import PackagePackageConfig from './package-packageConfig'
import PageSelect from '@/components/pageSelect/index.vue'
import packagePcSDK from './package-pcSDK.vue'
import redioRuleData from '@/utils/rules'
import PackageAdvertising from './package-advertising.vue'
import PackageProduct from './package-product.vue'
import PackageSDKMaintain from './package-SDKMaintain.vue'

export default {
  name: 'ExamPackage',
  components: {
    PackageEdit,
    PackageSdkEdit,
    PackagePayEdit,
    PackageAgeEdit,
    ChannelTemplate,
    PageSelect,
    PackageLandingPage,
    PackageSign,
    PackagePackageConfig,
    packagePcSDK,
    PackageAdvertising,
    PackageProduct,
    PackageSDKMaintain
  },
  computed: {
    ...mapGetters(['permission'])
  },
  data() {
    return {
      // 表格数据接口
      url: '/package/index',
      // 表格列配置
      columns: [
        {
          columnKey: 'selection',
          type: 'selection',
          width: 45,
          align: 'center',
          fixed: 'left'
        },
        {
          prop: 'id',
          label: 'ID',
          width: 60,
          align: 'center',
          showOverflowTooltip: true,
          fixed: 'left'
        },
        {
          prop: 'game_name',
          label: '关联游戏',
          showOverflowTooltip: true,
          minWidth: 200,
          align: 'center'
        },
        {
          prop: 'relation_package_ids',
          label: '关联游戏id',
          showOverflowTooltip: true,
          minWidth: 200,
          align: 'center'
        },
        {
          prop: 'channel_name',
          label: '所属渠道',
          showOverflowTooltip: true,
          minWidth: 200,
          align: 'center'
        },
        {
          prop: 'package_name',
          label: '游戏包名称',
          showOverflowTooltip: true,
          minWidth: 200,
          align: 'center'
        },
        {
          prop: 'icon',
          label: 'icon',
          showOverflowTooltip: true,
          align: 'center',
          minWidth: 200,
          slot: 'avatar'
        },
        {
          //  类型追加时修改
          prop: 'sdk_version',
          label: '区别版本',
          showOverflowTooltip: true,
          minWidth: 200,
          align: 'center',
          formatter: (row, column, cellValue) => {
            if (cellValue == 1) {
              return '安卓'
            } else if (cellValue == 2) {
              return '苹果'
            } else if (cellValue == 3) {
              return 'h5'
            } else if (cellValue == 4) {
              return 'pc'
            } else if (cellValue == 5) {
              return '小程序'
            }
          }
        },
        {
          prop: 'game_appid',
          label: '游戏appid',
          showOverflowTooltip: true,
          minWidth: 200,
          align: 'center'
        },
        //             {
        //   prop: 'relation_package_id',
        //   label: '',
        //   showOverflowTooltip: true,
        //   minWidth: 200,
        //   align: 'center',
        // },
        //             {
        //   prop: 'relation_package_name',
        //   label: '包名称',
        //   showOverflowTooltip: true,
        //   minWidth: 200,
        //   align: 'center',
        // },
        // {
        //   prop: "pay_notify_url",
        //   label: "游戏支付通知地址",
        //   showOverflowTooltip: true,
        //   minWidth: 200,
        //   align: "center"
        // },
        // {
        //   prop: "access_key",
        //   label: "访问秘钥",
        //   showOverflowTooltip: true,
        //   minWidth: 200,
        //   align: "center"
        // },
        {
          prop: 'status',
          label: '状态',
          showOverflowTooltip: true,
          minWidth: 200,
          align: 'center',
          formatter: (row, column, cellValue) => {
            if (cellValue == 1) {
              return '启用'
            } else if (cellValue == 0) {
              return '禁用'
            }
          }
        },
        {
          prop: 'create_time',
          label: '创建时间',
          sortable: 'custom',
          showOverflowTooltip: true,
          minWidth: 160,
          align: 'center',
          formatter: (row, column, cellValue) => {
            return this.$util.toDateString(cellValue)
          }
        },
        {
          prop: 'update_time',
          label: '更新时间',
          sortable: 'custom',
          showOverflowTooltip: true,
          minWidth: 160,
          align: 'center',
          formatter: (row, column, cellValue) => {
            return this.$util.toDateString(cellValue)
          }
        },
        {
          prop: 'bundle_id',
          label: 'BundleId',
          showOverflowTooltip: true,
          minWidth: 200,
          align: 'center'
        },
        {
          prop: 'h5_game_url',
          label: 'h5游戏原链',
          showOverflowTooltip: true,
          minWidth: 200,
          align: 'center'
        },
        {
          prop: 'jh_id',
          label: '聚合id',
          showOverflowTooltip: true,
          minWidth: 200,
          align: 'center'
        },
        {
          columnKey: 'action',
          label: '操作',
          width: 150,
          align: 'center',
          resizable: false,
          slot: 'action',
          fixed: 'right'
        }
      ],
      // 表格搜索条件
      where: {},
      // 表格选中数据
      selection: [],
      // 当前编辑数据
      current: null,
      // 是否显示编辑弹窗
      showEdit: false,
      // 是否显示sdk编辑弹窗
      showSdkEdit: false,
      // 是否显示pc sdk 热更新配置
      showPCSDK: false,
      //是否显示广告商务参数配置
      showAdvertising: false,
      // 是否显示pay编辑弹窗
      showPayEdit: false,
      // 是否显示age编辑弹窗
      showAgeEdit: false,
      // 是否显示Channel编辑弹窗
      showChannelTemplate: false,
      // 是否显示landingPage编辑弹窗
      showlandingPage: false,
      // 是否显示sign编辑弹窗
      showSign: false,
      // 是否显示packageConfig编辑弹窗
      showPackageConfig: false,
      redios: redioRuleData(),
      // 是否显示为关联
      showEditRelevance: false,
      // 同步计费点弹窗
      showProduct: false,
      selectPackage:'',//批量支付设置 选中数据
      // 是否显示SDK维护配置弹框
      showSDKMaintain:false,
    }
  },
  methods: {
    /* 重新打包 */
    setApplyStatus(row) {
      this.$http.post('Package/setApplyStatus', { id: row.id }).then((res) => {
        if (res.data.code === 0) {
          this.$message.success(res.data.msg)
        } else {
          this.$message.error(res.data.msg)
        }
      })
    },
    /*同步计费点 */
    setProduct(row) {
      this.current = row
      this.showProduct = true
      // this.$http
      //   .post('Package/setProduct', { id: row.id, channel_id: row.channel_id })
      //   .then((res) => {
      //     if (res.data.code === 0) {
      //       this.$message.success(res.data.msg)
      //     } else {
      //       this.$message.error(res.data.msg)
      //     }
      //   })
    },
    //唤醒sdk维护配置摊款
    openSDKMaintain(row){
      this.current = row
      this.showSDKMaintain=true
    },
    /* 刷新表格 */
    reload() {
      this.$refs.table.reload({ where: this.where })
    },
    /* 重置搜索 */
    reset() {
      this.where = {}
      this.reload()
    },
    /* 显示编辑 */
    openEdit(row, isRelevance) {
      // console.log(row, '!!')
      this.current = row
      this.showEdit = true
      // 是否为关联或者修改或者添加
      isRelevance != null
        ? (this.showEditRelevance = isRelevance)
        : (this.showEditRelevance = null)
    },
    //唤醒PCSDK
    openPackagePCSDK(row) {
      this.current = row
      this.showPCSDK = true
    },
    openAdvertising(row) {
      this.current = row
      this.showAdvertising = true
    },
    openSdkEdit(row) {
      this.current = row
      this.showSdkEdit = true
    },
    openPayEdit(row) {
      if(!row){
        if(!this.selection||this.selection.length==0){
          this.$message.warning('请选择需要配置的数据!')
          return false
        }else{
          let list=[]
          this.selection.forEach(item=>{
            list.push(item.id)
          })
          this.selectPackage=list.join(',')
        }
      }
      this.current = row
      this.showPayEdit = true
    },
    openAgeEdit(row) {
      this.current = row
      this.showAgeEdit = true
    },
    openChannelTemplate(row) {
      this.current = row
      this.showChannelTemplate = true
    },
    openLandingPage(row) {
      this.current = row
      this.showlandingPage = true
    },
    openSign(row) {
      this.current = row
      this.showSign = true
    },
    openPackageConfig(row) {
      this.current = row
      this.showPackageConfig = true
    },
    openCopy(row) {
      this.$http
        .post('/package/copyMessage', { package_id: row.id })
        .then((res) => {
          if (res.data.code === 0) {
            //获取的值

            // let package_name_res =
            //   res.data.data.package_name !== null &&
            //   res.data.data.package_name !== undefined
            //     ? res.data.data.package_name
            //     : "";
            // let app_name_res =
            //   res.data.data.app_name !== null &&
            //   res.data.data.app_name !== undefined
            //     ? res.data.data.app_name
            //     : "";
            // let app_id_res =
            //   res.data.data.app_id !== null &&
            //   res.data.data.app_id !== undefined
            //     ? res.data.data.app_id
            //     : "";
            // let app_secret_res =
            //   res.data.data.app_secret !== null &&
            //   res.data.data.app_secret !== undefined
            //     ? res.data.data.app_secret
            //     : "";
            // let payment_key_res =
            //   res.data.data.payment_key !== null &&
            //   res.data.data.payment_key !== undefined
            //     ? res.data.data.payment_key
            //     : "";
            // let h5_game_url_res =
            //   res.data.data.h5_game_url !== null &&
            //   res.data.data.h5_game_url !== undefined
            //     ? res.data.data.h5_game_url
            //     : "";
            // let h5_game_address_res =
            //   res.data.data.h5_game_address !== null &&
            //   res.data.data.h5_game_address !== undefined
            //     ? res.data.data.h5_game_address
            //     : "";
            // let channel_order_notify_res =
            //   res.data.data.channel_order_notify !== null &&
            //   res.data.data.channel_order_notify !== undefined
            //     ? res.data.data.channel_order_notify
            //     : "";

            // // 版本循环 安卓 1  iso 2 pc 3  h5 4
            // let android_res = "";
            // let ios_res = "";
            // let pc_res = "";
            // let h5_res = "";

            // res.data.data.package_id_data.map(item => {
            //   if (item.sdk_version === 1) {
            //     android_res = item.id;
            //   } else if (item.sdk_version === 2) {
            //     ios_res = item.id;
            //   } else if (item.sdk_version === 3) {
            //     pc_res = item.id;
            //   } else if (item.sdk_version === 4) {
            //     h5_res = item.id;
            //   }
            // });
            // console.log(
            //   res.data.data,
            //   "rrrrrrrrrrrr",
            //   android_res,
            //   ios_res,
            //   pc_res,
            //   h5_res
            // );

            // let package_name = "游戏名称： " + package_name_res + "\n";
            // let app_name = "项目名称： " + app_name_res + "\n";
            // let app_id = "appid（项目id）： " + app_id_res + "\n";
            // let app_secret = "应用密钥： " + app_secret_res + "\n";
            // let payment_key = "支付密钥： " + payment_key_res + "\n";
            // let channel_order_notify_android = "";
            // channel_order_notify_android = android_res
            //   ? "安卓package_id：" + android_res + "\n"
            //   : "";
            // let channel_order_notify_ios = "";
            // channel_order_notify_ios = ios_res
            //   ? "iOS package_id：" + ios_res + "\n"
            //   : "";
            // let channel_order_notify_pc = "";
            // channel_order_notify_pc = pc_res
            //   ? "pc package_id：" + pc_res + "\n"
            //   : "";
            // let channel_order_notify_h5 = "";
            // channel_order_notify_h5 = h5_res
            //   ? "h5 package_id：" + h5_res + "\n"
            //   : "";
            // let h5_game_url = "h5游戏原链： " + h5_game_url_res + "\n";

            // let channel_order_notify =
            //   "渠道支付回调地址： " + channel_order_notify_res + "\n";
            // let h5_game_address =
            //   "h5游戏推广地址： " + h5_game_address_res + "\n";
            // const copyText =
            //   package_name +
            //   app_name +
            //   app_id +
            //   app_secret +
            //   payment_key +
            //   channel_order_notify_android +
            //   channel_order_notify_ios +
            //   channel_order_notify_pc +
            //   channel_order_notify_h5 +
            //   h5_game_url +
            //   channel_order_notify +
            //   h5_game_address;

            this.$copyText(res.data.data).then(
              this.$message.success('复制成功')
            )
          } else {
            this.$message.error(res.data.msg)
          }
        })
        .catch((e) => {
          this.$message.error(e.message)
        })
    },
    openPackageChannelApply(row) {
      this.$http
        .post('/package/setPackageChannelApply', { package_id: [row.id] })
        .then((res) => {
          if (res.data.code === 0) {
            this.$message.success(res.data.msg)
          } else {
            this.$message.error(res.data.msg)
          }
        })
        .catch((e) => {
          this.$message.error(e.message)
        })
    },
    openPackageChannelApplyBatch() {
      const BatchID = []
      this.selection.map((item) => {
        BatchID.push(item.id)
      })
      this.$http
        .post('/package/setPackageChannelApply', { package_id: BatchID })
        .then((res) => {
          console.log(res.data, 'PackageChannelApply')
          if (res.data.code === 0) {
            this.$message.success(res.data.msg)
          } else {
            this.$message.error(res.data.msg)
          }
        })
        .catch((e) => {
          this.$message.error(e.message)
        })
    },
    /* 删除 */
    remove(row) {
      const loading = this.$loading({ lock: true })
      this.$http
        .post('/package/delete', { package_id: row.id })
        .then((res) => {
          loading.close()
          if (res.data.code === 0) {
            this.$message.success(res.data.msg)
            this.reload()
          } else {
            this.$message.error(res.data.msg)
          }
        })
        .catch((e) => {
          loading.close()
          this.$message.error(e.message)
        })
    },
    /* 批量删除 */
    removeBatch() {
      if (!this.selection.length) {
        this.$message.error('请至少选择一条数据')
        return
      }
      this.$confirm('确定要删除选中的游戏包吗?', '提示', {
        type: 'warning'
      })
        .then(() => {
          const loading = this.$loading({ lock: true })
          this.$http
            .post('/package/delete', { id: this.selection.map((d) => d.id) })
            .then((res) => {
              loading.close()
              if (res.data.code === 0) {
                this.$message.success(res.data.msg)
                this.reload()
              } else {
                this.$message.error(res.data.msg)
              }
            })
            .catch((e) => {
              loading.close()
              this.$message.error(e.message)
            })
        })
        .catch(() => {})
    }
  }
}
</script>

<style scoped></style>
